package com.atjglz.gmall.user.controller;

import com.atjglz.gmall.user.bean.UmsMember;
import com.atjglz.gmall.user.bean.UmsMemberReceiveAddress;
import com.atjglz.gmall.user.mapper.UserMapperDao;
import com.atjglz.gmall.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    UserService userService;


    @RequestMapping("index")
    @ResponseBody
    public String index() {
        return "Hello World";
    }

    @RequestMapping("getAllUser")
    @ResponseBody
    public List<UmsMember> getAllUser() {
        List<UmsMember> umsNumberList = userService.getAllUser();
        return umsNumberList;
    }

    @RequestMapping("getReceiveAddressByNumberId")
    @ResponseBody
    public List<UmsMemberReceiveAddress> getReceiveAddressByNumberId(Integer memberId) {
        List<UmsMemberReceiveAddress> umsMemberReceiveAddresses = userService.selectAll(memberId);
        return umsMemberReceiveAddresses;
    }
}
